using System;
using System.IO;

namespace WordsHelper.DAL.Models
{
    internal class DatabaseInfo
    {
        internal string FileName { get; set; }
        internal string DataSource { get; set; }

        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="ArgumentException"></exception>
        internal DatabaseInfo(string fileName, string password)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }
            if (fileName.Length == 0)
            {
                throw new ArgumentException("Empty String.", "fileName");
            }
            FileName = fileName;
            var path = Path.Combine(Environment.CurrentDirectory, fileName);
            DataSource = string.IsNullOrEmpty(password) ? "Data Source=" + path : "Data Source=" + path + ";Password=" + password;
        }
    }
}